# coding: utf-8
from sqlalchemy import Column, String, DATETIME
from sqlalchemy.dialects.mysql import INTEGER, TINYINT, VARCHAR
from ..database import db,serialize


class Type(db.Model):
    __tablename__ = 'types'

    id = Column(INTEGER(10), primary_key=True)
    parentid = Column(INTEGER(10), nullable=False)
    arrparentid = Column(VARCHAR(255))
    child = Column(TINYINT(4))
    arrchildid = Column(TEXT)
    name = Column(VARCHAR(200), nullable=False)
    sort = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
    created_at = Column(DATETIME, default=datetime.now())
    updated_at = Column(DATETIME, default=datetime.now(), server_default=func.now(), onupdate=func.now(), comment='修改时间')

